package com.ricchieri.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.ricchieri.dao.interf.IEmailToSendDao;
import com.ricchieri.filter.EmailToSendFilter;
import com.ricchieri.model.EmailToSend;
import com.ricchieri.service.interf.IEmailToSendService;

@Transactional(readOnly = true)
public class EmailToSendService implements IEmailToSendService, Serializable {
	private static final long serialVersionUID = -7948218044925472263L;
	IEmailToSendDao emailToSendDao;
	
	@Override
	@Transactional(readOnly = true)
	public List<EmailToSend> getAllEmailToSend() {
		EmailToSendFilter emailToSendFilter = new EmailToSendFilter();
		return emailToSendDao.getAllEmailToSend(emailToSendFilter);
	}

	public IEmailToSendDao getEmailToSendDao() {
		return emailToSendDao;
	}

	public void setEmailToSendDao(IEmailToSendDao emailToSendDao) {
		this.emailToSendDao = emailToSendDao;
	}

	@Override
	@Transactional(readOnly = false)
	public void update(EmailToSend emailToSend) {
		emailToSendDao.update(emailToSend);
	}

	@Override
	@Transactional(readOnly = false)
	public void add(EmailToSend emailToSend) {
		emailToSendDao.add(emailToSend);
	}

	@Override
	public List<EmailToSend> getAllEmailToSendPaginatedByFilter(EmailToSendFilter emailToSendFilter, int startingAt) {
		return emailToSendDao.getAllEmailToSendPaginatedByFilter(emailToSendFilter, startingAt);
	}

	@Override
	public int getAllEmailToSendPaginatedCountByFilter(EmailToSendFilter emailToSendFilter) {
		return emailToSendDao.getAllEmailToSendPaginatedCountByFilter(emailToSendFilter);
	}
}
